Skip to content

Support the password config item type #2463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sgalsaleh
Copy link
Member

What this PR does / why we need it:

Adds support for the password config item type

Which issue(s) this PR fixes:

SC-126349

Does this PR require a test?

Yes

Does this PR require a release note?

NONE

Does this PR require documentation?

NONE

Loom

https://www.loom.com/share/9cddba2435a14326badbe8ed57313709?sid=911515cb-68a5-4912-af3f-8ebd3338d13a

Copy link
Member

@emosbaugh emosbaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment. i think its confusing that i cannot tell as an end user when the value stored is empty. why not show it as empty if it is empty?

and one question. what happens if you tab through the inputs? is the tab considered a keystroke and does it clear the password value rather than focusing on the next input?

Copy link

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-8a6a1a3" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-8a6a1a3?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

// Merge new values with existing ones
mergedValues := make(map[string]string)
maps.Copy(mergedValues, existingValues)
maps.Copy(mergedValues, newValues)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will mutate the original. why not make a copy? https://go.dev/play/p/t4OsmJsnaDV

Comment on lines +80 to +82
if _, exists := maskedValues[item.Name]; exists {
maskedValues[item.Name] = PasswordMask
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps you should not set the mask here if its empty

Suggested change
if _, exists := maskedValues[item.Name]; exists {
maskedValues[item.Name] = PasswordMask
}
if val := maskedValues[item.Name]; val != "" {
maskedValues[item.Name] = PasswordMask
}

// override values from the config values store
if value, ok := storedValues[item.Name]; ok {
configValue.Value = value
if item.Type == "password" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like you should do the same here for sub items. even if we do not support password types, it cant hurt and we will introduce a bug in the future if we ever do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see there is not type. never mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants